﻿<UserControl x:Class="SQLDeploy.Builder.Controls.Connections.List"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <Style x:Key ="hcs" TargetType="{x:Type GridViewColumnHeader}">
            <Setter Property="HorizontalContentAlignment" Value="Left"/>
        </Style>
    </UserControl.Resources>
    <Grid>
        
        <ListView Name="lsv_connections"
                  IsHitTestVisible="True"
                  IsTextSearchEnabled="True"
                  ItemsSource="{Binding Path=Connections}"
                  SelectionMode="Single">
            
            <ListView.ItemContainerStyle>
                <Style TargetType="{x:Type ListViewItem}">
                    <Style.Triggers>
                        <Trigger Property="IsKeyboardFocusWithin" Value="True">
                            <Setter Property="IsSelected" Value="True"/>
                        </Trigger>
                    </Style.Triggers>
                </Style>
            </ListView.ItemContainerStyle>
            
            <ListView.View>
                <GridView>
                    <GridViewColumn Header="Connection Name" Width="Auto"
                                    DisplayMemberBinding="{Binding Name}"
                                    HeaderContainerStyle="{StaticResource hcs}"/>
                </GridView>
            </ListView.View>
            <ListView.ItemTemplate>
                <ItemContainerTemplate>
                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto"/>
                            <ColumnDefinition Width="*"/>
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Image Grid.Column="0" Grid.Row="0"
                               />
                        <TextBlock
                            Grid.Column="1" Grid.Row="0"
                            FontWeight="Bold" FontSize="14" Text="{Binding ConnectionTypeHeading}"/>
                    </Grid>
                </ItemContainerTemplate>
            </ListView.ItemTemplate>
        </ListView>
        
    </Grid>
</UserControl>
